#include "gamewindow.h"

GameWindow::GameWindow(QWidget* parent):QMainWindow(parent) {
    setWindowTitle("Zeus-Pater");
    setFixedSize(1000,700);

    stackedWidget=new QStackedWidget(this);
    setCentralWidget(stackedWidget);

    startMenu=new StartMenu;
    gameWidget=new GameWidget;
    pauseMenu=new PauseMenu;
    resultMenu=new ResultMenu;

    stackedWidget->addWidget(startMenu);
    stackedWidget->addWidget(gameWidget);
    stackedWidget->addWidget(pauseMenu);
    stackedWidget->addWidget(resultMenu);

    connect(startMenu,&StartMenu::startGame,[this](){
        gameWidget->startGame();
        stackedWidget->setCurrentWidget(gameWidget);
    });

    connect(gameWidget,&GameWidget::gamePaused,[this](){
        pauseMenu->setPauseText();
        stackedWidget->setCurrentWidget(pauseMenu);
    });

    connect(pauseMenu,&PauseMenu::resumeGame,[this](){
        stackedWidget->setCurrentWidget(gameWidget);
        gameWidget->resumeGame();
    });

    connect(gameWidget,&GameWidget::gameOver,[this](bool win){
        resultMenu->setResult(win);
        stackedWidget->setCurrentWidget(resultMenu);
    });

    connect(resultMenu,&ResultMenu::returnToMenu,[this](){
        stackedWidget->setCurrentWidget(startMenu);
    });

    stackedWidget->setCurrentWidget(startMenu);
}

GameWindow::~GameWindow(){

}
